Ext.define('Ext.app.DueContractPortlet', {
    extend: 'Ext.grid.Panel',
    alias: 'widget.gridportlet',
    height: 180,

    initComponent: function(){
        var store = Ext.create('Ext.data.Store', {
            fields: [
               {name: 'id'},
               {name: 'student__company__cn_name'},
               {name: 'student__student_manager__name'},
               {name: 'name'},
               {name: 'student__name'},
               {name: 'contract_type'},
               {name: 'end_time'}
            ],
		    proxy: {
		        type: 'ajax',
		        url: '/usercontrol/index_contract_warning/',
		        actionMethods:'post',
		        reader: {
		            type: 'json',
		            root: 'rows',
		            totalProperty: 'totalCount'
		        }
		    },
		    autoLoad: true
        });

        Ext.apply(this, {
            height: this.height,
            store: store,
            stripeRows: true,
            columnLines: true,
            columns: [
            {
                text   : '校区',
                width: 80,
                sortable : false,
                dataIndex: 'student__company__cn_name'
            },{
                text   : '学管师',
                width: 50,
                sortable : false,
                dataIndex: 'student__student_manager__name'
            },
            {
                text   : '合同编号',
                width: 100,
                sortable : false,
                dataIndex: 'name'
            },{
                text   : '学生姓名',
                width: 55,
                sortable : false,
                dataIndex: 'student__name'
            },{
                text   : '合同类型',
                width: 55,
                sortable : false,
                flex:1,
                dataIndex: 'contract_type',
				renderer:function(v){
	            	if (v==1) 
	                	return '新签'
	                else if (v==2)
	                    return '续费'   
	    			else
	        			return '退费'
            	}                
            },{
            	text   : '到期时间',
                width: 120,
                sortable : false,
                dataIndex: 'end_time'
            }]
        });

        this.callParent(arguments);
    }
});

